import { Descriptions} from 'antd';
import dayjs from 'dayjs';
export type RunStateProps = {
  row: API.ProductSub;
};
const RunState: React.FC<RunStateProps> = (record) => {
  let run_mode: string ="关机" ;
    switch (record.row.cmode) {
      case 0:
        run_mode = "自动";        
        break;
      case 1:
        run_mode = "制冷";        
        break;
      case 2:
        run_mode = "除湿";        
        break;
      case 3:
        run_mode = "送风";        
        break;
      case 4:
        run_mode = "制热";        
        break;
      default:
        run_mode = "开机";   
        break;
    }
  return (
    <>
         <Descriptions title={dayjs(record.row.updatetime).format('YYYY-MM-DD HH:mm:ss')} labelStyle={{color:"red"}} contentStyle={{color:"blue"}} size="small" bordered={true} column={5} >
          <Descriptions.Item label="模式">{run_mode}</Descriptions.Item>
          <Descriptions.Item label="设温">{record.row.ctemper}︒C</Descriptions.Item>
          <Descriptions.Item label="风速">{record.row.cfun===0?"自动":record.row.cfun} 档</Descriptions.Item>
{/*           <Descriptions.Item label="定时">{record.row.ctime/2} h</Descriptions.Item> */}
          <Descriptions.Item label="压档">{record.row.cdc_d} 档</Descriptions.Item>
          <Descriptions.Item label="设频">{record.row.ccompress_hz} Hz</Descriptions.Item>
        </Descriptions>
        <Descriptions contentStyle={{color:"blue"}} size="small" bordered={true} column={5} >
          <Descriptions.Item label="压机">{record.row.scompress_on?"开":"关"}</Descriptions.Item>
          <Descriptions.Item label="内机">{record.row.sfun_in_on?"开":"关"}</Descriptions.Item>
          <Descriptions.Item label="外机">{record.row.sfun_out_on?"开":"关"}</Descriptions.Item>
          <Descriptions.Item label="内温">{record.row.stemper_in}︒C</Descriptions.Item>
          <Descriptions.Item label="内管温">{record.row.stemper_in_pipe}︒C</Descriptions.Item>
          <Descriptions.Item label="压频">{record.row.scompress_hz} Hz</Descriptions.Item>    
          <Descriptions.Item label="内转">{record.row.sfun_in_speed} 档</Descriptions.Item>
          <Descriptions.Item label="外转">{record.row.sfun_out_speed}</Descriptions.Item>
          <Descriptions.Item label="环温">{record.row.stemper_out}︒C</Descriptions.Item>
          <Descriptions.Item label="排温">{record.row.stemper_ex}︒C</Descriptions.Item>
          <Descriptions.Item label="电流">{record.row.sdc_a} A</Descriptions.Item>
          <Descriptions.Item label="电压">{record.row.sdc_v} V</Descriptions.Item>
          <Descriptions.Item label="功率">{record.row.sdc_w} W</Descriptions.Item>
          </Descriptions>
{/*           <Descriptions>
          <Descriptions.Item label="更新时间">{dayjs(record.row.updatetime).format('YYYY-MM-DD HH:mm:ss')}</Descriptions.Item>
          </Descriptions> */}
    </>
  );
};

export default RunState;
